<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>班级通知</title>
	<link rel="stylesheet" href="../css/common2.css">

	<style>
		.search_img {
			position: absolute;
			margin-top: -35px;
			right: 3%;
		}

		td img {
			max-height: 64px;
		}

		.grade_input {
			right: 250px;
			height: 35px;
			box-sizing: border-box;
		}
	</style>
</head>

<body>
	<div id="vue-root" style="margin-top: 30px;">
		<div class="add">
			<a href="interactive_classes_notice_item.html" style="color: white">发布公告</a>
		</div>
		<div class="refresh" onclick="location.reload()">刷新</div>

		<div class="grade">
			<input class="search grade_input" style="margin-top: -35px;" v-model="search.teacherName" placeholder="请输入教师名">

			<select class="search" style="margin-top: -35px;" v-model="search.classesId">
				<option :value="undefined">请选择班级</option>
				<option v-for="classes in classess" :key="classes.id" :value="classes.id" v-text="classes.name">
				</option>
			</select>
		</div>
		<img src="../image/search.png" height="35" width="35" class="search_img" @click="getData0">

		<div class="table ">
			<table class="table_top">
				<thead>
					<tr>
						<th>
							<input type="checkbox" class="check-box" v-model="all">序号
						</th>
						<th>发布者</th>
						<th>班级</th>
						<th>标题</th>
						<th class="four">内容</th>
						<th>时间</th>
						<th>阅读人数</th>
						<th v-if="able.del" class="three">删除</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(notice,index) in list" :key="notice.id">
						<td>
							<input type="checkbox" class="check-box" v-model="notice.checked">
							<span v-text="index+1"></span>
						</td>
						<td v-text="notice.teacherName"></td>
						<td v-text="notice.classesName"></td>
						<td v-text="notice.title"></td>
						<td class="four" v-html="notice.text"></td>
						<td v-text="notice.time"></td>
						<td>{{notice.readCount}}/{{notice.totalCount}}</td>
						<td v-if="able.del" class="three">
							<div>
								<div class="delete-icon option-icon" @click="del([notice.id])">
									<img class="img" src="../image/delete.png" height="20" width="20"
										onmouseover="this.src='../image/delete_light.png'"
										onmouseout="this.src='../image/delete.png'" />
								</div>
							</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<br>
		<div class="delete" @click="batchDelete" v-if="able.del">批量删除</div>
		<ul class="pagination" v-if="pages>1">
			<li>
				<a v-if="pageNum!=1" @click="pageNum=1">«</a>
				<a class="pages-jump" v-if="pageNum!=1" @click="pageNum--">‹</a>
				<a v-text="pageNum"></a>
				<a class="pages-jump" v-if="pageNum!=pages" @click="pageNum++">›</a>
				<a v-if="pageNum!=pages" @click="pageNum=pages">»</a>
			</li>
		</ul>
	</div>
	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/auth_util.js"></script>

	<script>
		var app = new Vue(merge({
			data: {
				classess: [],
				urls: {
					del: '/pc/classesNotice/del'
				}
			},
			created: function () {
				var id = top_params().id;
				if (!id) return;
				this.schoolId = id;
				this.urls.list = '/pc/classesNotice/list/' + id;
				this.getData();
				axios.get('/pc/classes/all/' + id).then(function (res) {
					this.classess = res.data;
				}.bind(this));
				abled('classNotice', this);
			},
			methods: {
				getImg: function (pic) {
					return '/static/' + this.schoolId + '/classes_notice/' + pic;
				}
			}
		}));
	</script>
</body>

</html>